var PagerComp = require('rc-pager');
var Page = React.createClass({
    getInitialState:function(){
        return {
            current:1,
            total:20,
            items:[], // 每一页的item信息
        }
    },

    componentWillReceiveProps: function(){
        // debugger
        this.setState({
           
            total:this.props.total,
            items: this.props.items
        })
    },

    handleSkip:function(page){
        this.setState({
            current:page
        });
        if(this.props.select){
            this.props.select(page);
        }
    },
    render:function(){
        // debugger;
        return (
            <div>
            
                <PagerComp total={this.props.total} current={this.state.current} onSkipTo={this.handleSkip}/>
            </div>
        )
    }
});

module.exports = Page;